package com.dd.lnetwork

import android.text.TextUtils
import okhttp3.Interceptor
import okhttp3.Response

class GetInterceptor : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val originalResponse = chain.proceed(chain.request())
        val cookies = originalResponse.headers("Set-Cookie")
        if (cookies.isNotEmpty()) {
            val cookie = HashSet<String>()
            for (s in cookies) {
                if (!TextUtils.isEmpty(s)) {
                    cookie.add(s)
                }
            }

            if (cookie.size > 0) {
                //Save cookie
            }
        }
        return originalResponse
    }
}